<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Title</title>
    <link rel="stylesheet" th:href="@{/plugins/layui/css/layui.css}">
</head>

<body>
<div class="layui-form" th:object="${team}">
    <!--隐藏域-->
    <input type="hidden" id="teamId" th:field="*{teamId}">
    <div class="layui-form-item">
        <label class="layui-form-label">班级名称</label>
        <div class="layui-input-inline layui-input-wrap">
            <input type="text" id="teamName" th:field="*{teamName}" lay-verify="required" autocomplete="off" lay-affix="clear" class="layui-input">
        </div>
        <!--th:field获取值-->
        <!--所属年级-->
        <div class="layui-form-item">
            <label class="layui-form-label">所属年级</label>
            <div class="layui-input-inline layui-input-wrap">
                <select id="gradeId" name="gradeId" th:with="grades=${@gradeService.getGradeList()}">
                    <option value="">请选择年级</option>
                    <option th:each="g:${grades}" th:text="${g.gradeName}" th:value="${g.gradeId}" th:selected="${team.grade!=null&&g.gradeId==team.grade.gradeId}"></option>
                </select>
            </div>
        </div>
    </div>
</div>
<script th:src="@{/js/plugins/layui/layui.js}"></script>
<script th:src="@{/js/jquery.min.js}"></script>
</body>
</html>
